package com.itheima.反射.获取class对象的三种方式;

/**
 * @Author 王加鑫
 * @Date 2021/5/26 10:44
 * @Version 1.0
 * 获取class对象三种形式
 */
public class ReflectDemo01 {
    public static void main(String[] args) throws ClassNotFoundException {
        Class<?> c1 = Class.forName("com.itheima.反射.获取class对象的三种方式.Hero");
        System.out.println(c1);

        Class<Hero> c2 = Hero.class;
        System.out.println(c2);

        Hero hero = new Hero();
        Class c3 = hero.getClass();
        System.out.println(c3);

        System.out.println(c1 == c2);
        System.out.println(c2 == c3);


    }
}
